<template>
	<view class="content">
		<view class="ti_detail">
			<view v-for="(item,index) in list" :key="index">
				<view class="ti_item" v-if="item.type ==1">
					<image src="../../../../static/alipay.png" mode="" ></image>
					<view class="ti_c">
						<view class="ti_title" v-if="item.status == 1">支付宝提现中</view>
						<view class="ti_title" v-if="item.status == 2">支付宝提现成功</view>
						<view class="ti_title" v-if="item.status == 3">支付宝提现失败</view>
						<view class="ti_time">{{item.createtime| formatDate}}</view>
					</view>
					<view class="ti_r ti_r1" v-if="item.status == 1">-{{item.tx_amount}}</view>
					<view class="ti_r" v-if="item.status == 2">-{{item.tx_amount}}</view>
					<view class="ti_r ti_r2" v-if="item.status == 3">-{{item.tx_amount}}</view>
				</view>
				<view class="ti_item" v-else>
					<image class="card" src="../../../../static/card.png" mode=""></image>
					<view class="ti_c">
						<view class="ti_title" v-if="item.status == 1">银行卡提现中</view>
						<view class="ti_title" v-if="item.status == 2">银行卡提现成功</view>
						<view class="ti_title" v-if="item.status == 3">银行卡提现失败</view>
						<view class="ti_time">{{item.createtime| formatDate}}</view>
					</view>
					<view class="ti_r ti_r1" v-if="item.status == 1">-{{item.tx_amount}}</view>
					<view class="ti_r" v-if="item.status == 2">-{{item.tx_amount}}</view>
					<view class="ti_r ti_r2" v-if="item.status == 3">-{{item.tx_amount}}</view>
				</view>
			</view>
			<view class="wu" v-if="list.length == 0">暂无数据~</view> 
<!-- 			<view class="ti_item">
				<image class="card" src="../../../../static/card.png" mode=""></image>
				<view class="ti_c">
					<view class="ti_title">
						银行卡提现中
					</view>
					<view class="ti_time">
						2019.06.24 15:24
					</view>
				</view>
				<view class="ti_r ti_r1">-100</view>
			</view>
			<view class="ti_item">
				<image src="../../../../static/alipay.png" mode=""></image>
				<view class="ti_c">
					<view class="ti_title">
						支付宝提现失败
					</view>
					<view class="ti_time">
						2019.06.24 15:24
					</view>
				</view>
				<view class="ti_r ti_r2">-100</view>
			</view> -->
		</view>
	</view>
</template>

<script>
import getdata from '@/common/ajax.js';	
	export default {	
		data() {
			return {
				list:[]
			}
		},
		onLoad() {
			uni.showLoading({
			    title: '加载中'
			});
			this.jilu()
		},
		methods: {
			jilu(){
				//获取提现列表
				var _this = this
				var token = uni.getStorageSync('token')
				uni.request({
					url: getdata.websiteUrl + '/user/withdraw_log',
					header:{'content-type': "application/x-www-form-urlencoded",token:token},
					dataType: 'json',
					method: 'POST',
					success: res => {
						uni.hideLoading();
						console.log(res,'list')
						if(res.data.code == 1){
							_this.list = res.data.data
						}else if(res.data.code == 401){
							getdata.shou('请登录')
							uni.reLaunch({
							    url: '../login/login'
							});
						}else{
							getdata.shou(res.data.msg)
						}
						
					},
					fail: res => {
						uni.hideLoading();
						console.log(res,'11111')
						getdata.shou('服务器断开链接')
					}
				});
			},
			 
		},
		filters:{
			//过滤器，时间戳转时间
				formatDate: function(value) {
					var date = new Date();
					//date.setTime(value);
					var month = date.getMonth() + 1;
					var hours = date.getHours();
					if (hours < 10)
						hours = "0" + hours;
					var minutes = date.getMinutes();
					if (minutes < 10)
						minutes = "0" + minutes;
					var time = date.getFullYear() + "-" + month + "-" + date.getDate() +
						" " + hours + ":" + minutes;
					return time;
				}
				
		},
	}
</script>

<style lang="scss">
.wu{
	text-align: center;
	font-size: 30rpx;
	color: #8D8D97;
}		
.ti_detail{
	box-sizing: border-box;
	padding: 0 30rpx;
	padding-top: 25rpx;
	.ti_item{
		display: flex;
		border-bottom: 2rpx solid #E3DFDF;
		padding: 50rpx 0;
		padding-left: 25rpx;
		padding-right: 28rpx;
		image{
			width: 50rpx;
			height: 50rpx;
		}
		.card{
			width: 44rpx;
			height: 32rpx;
		}
		.ti_c{
			margin-left: 26rpx;
			font-size: 26rpx;
			line-height: 26rpx;
			font-family: PingFang SC;
			color: #302E37;
			.ti_title{
				
			}
			.ti_time{
				margin-top: 20rpx;
			}
		}
		.ti_r{
			margin-left: auto;
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 800;
			color: #FF4F26;

		}
		.ti_r1{
			color: #FFC926;
		}
		.ti_r2{
			color: #D9D8D5;
		}
	}
}
</style>
